<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Jialeo\LaravelSchemaExtend\Schema;

class CreateAppraiseMessageTasksTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('appraise_message_tasks', function (Blueprint $table) {
            $table->id();
            $table->string('targetId', 64)->default('')->comment('业务的主键');
            $table->unsignedTinyInteger('type')->default(0)->comment('业务类型枚举值，参考AppraiseModel');
            $table->unsignedInteger('userId')->default(0)->comment('给某个人发送,rms.kf_user主键');
            $table->unsignedInteger('shopId')->default(0)->comment('给某个门店,rms.kf_shops主键');
            $table->text('messageParams')->comment('消息参数，动态消息模板参数');
            $table->unsignedInteger('appointmentAt')->default(0)->comment('预约发送时间');
            $table->unsignedInteger('sendAt')->default(0)->comment('实际发送时间');
            $table->unsignedInteger('createdAt')->default(0)->comment('创建时间');
            $table->unsignedInteger('createdByUid')->default(0)->comment('创建人');
            $table->unsignedInteger('updatedAt')->default(0)->comment('修改时间');
            $table->unsignedInteger('updatedByUid')->default(0)->comment('修改人');
            $table->unsignedTinyInteger('isDeleted')->default(0)->comment('');
            $table->index(['sendAt'], 'sendAt');
            $table->collation = 'utf8mb4_general_ci';
            $table->comment   = '评价模块-评价消息推送任务列表';
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('appraise_message_tasks');
    }
}
